// Licensed to the Apache Software Foundation (ASF) under one// or more contributor license agreements. See the NOTICE file// distributed with this work for additional information// regarding copyright ownership. The ASF licenses this file// to you under the Apache License, Version 2.0 (the// "License"); you may not use this file except in compliance// with the License. You may obtain a copy of the License at//// http://www.apache.org/licenses/LICENSE-2.0//// Unless required by applicable law or agreed to in writing, software// distributed under the License is distributed on an "AS IS" BASIS,// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.// See the License for the specific language governing permissions and// limitations under the License.// Code generated by the FlatBuffers compiler. DO NOT EDIT.package flatbufimport (flatbuffers)// / ----------------------------------------------------------------------// / EXPERIMENTAL: Data structures for sparse tensors// / Coordinate (COO) format of sparse tensor index.// /// / COO's index list are represented as a NxM matrix,// / where N is the number of non-zero values,// / and M is the number of dimensions of a sparse tensor.// /// / indicesBuffer stores the location and size of the data of this indices// / matrix. The value type and the stride of the indices matrix is// / specified in indicesType and indicesStrides fields.// /// / For example, let X be a 2x3x4x5 tensor, and it has the following// / 6 non-zero values:// / ```text// / X[0, 1, 2, 0] := 1// / X[1, 1, 2, 3] := 2// / X[0, 2, 1, 0] := 3// / X[0, 1, 3, 0] := 4// / X[0, 1, 2, 1] := 5// / X[1, 2, 0, 4] := 6// / ```// / In COO format, the index matrix of X is the following 4x6 matrix:// / ```text// / [[0, 0, 0, 0, 1, 1],// / [1, 1, 1, 2, 1, 2],// / [2, 2, 3, 1, 2, 0],// / [0, 1, 0, 0, 3, 4]]// / ```// / When isCanonical is true, the indices is sorted in lexicographical order// / (row-major order), and it does not have duplicated entries. Otherwise,// / the indices may not be sorted, or may have duplicated entries.typeSparseTensorIndexCOOstruct { _tab flatbuffers.Table}func ( []byte, flatbuffers.UOffsetT) *SparseTensorIndexCOO { := flatbuffers.GetUOffsetT([:]) := &SparseTensorIndexCOO{} .Init(, +)return}func ( *SparseTensorIndexCOO) ( []byte, flatbuffers.UOffsetT) { ._tab.Bytes = ._tab.Pos = }func ( *SparseTensorIndexCOO) () flatbuffers.Table {return ._tab}// / The type of values in indicesBufferfunc ( *SparseTensorIndexCOO) ( *Int) *Int { := flatbuffers.UOffsetT(._tab.Offset(4))if != 0 { := ._tab.Indirect( + ._tab.Pos)if == nil { = new(Int) } .Init(._tab.Bytes, )return }returnnil}// / The type of values in indicesBuffer// / Non-negative byte offsets to advance one value cell along each dimension// / If omitted, default to row-major order (C-like).func ( *SparseTensorIndexCOO) ( int) int64 { := flatbuffers.UOffsetT(._tab.Offset(6))if != 0 { := ._tab.Vector()return ._tab.GetInt64( + flatbuffers.UOffsetT(*8)) }return0}func ( *SparseTensorIndexCOO) () int { := flatbuffers.UOffsetT(._tab.Offset(6))if != 0 {return ._tab.VectorLen() }return0}// / Non-negative byte offsets to advance one value cell along each dimension// / If omitted, default to row-major order (C-like).func ( *SparseTensorIndexCOO) ( int, int64) bool { := flatbuffers.UOffsetT(._tab.Offset(6))if != 0 { := ._tab.Vector()return ._tab.MutateInt64(+flatbuffers.UOffsetT(*8), ) }returnfalse}// / The location and size of the indices matrix's datafunc ( *SparseTensorIndexCOO) ( *Buffer) *Buffer { := flatbuffers.UOffsetT(._tab.Offset(8))if != 0 { := + ._tab.Posif == nil { = new(Buffer) } .Init(._tab.Bytes, )return }returnnil}// / The location and size of the indices matrix's data// / This flag is true if and only if the indices matrix is sorted in// / row-major order, and does not have duplicated entries.// / This sort order is the same as of Tensorflow's SparseTensor,// / but it is inverse order of SciPy's canonical coo_matrix// / (SciPy employs column-major order for its coo_matrix).func ( *SparseTensorIndexCOO) () bool { := flatbuffers.UOffsetT(._tab.Offset(10))if != 0 {return ._tab.GetBool( + ._tab.Pos) }returnfalse}// / This flag is true if and only if the indices matrix is sorted in// / row-major order, and does not have duplicated entries.// / This sort order is the same as of Tensorflow's SparseTensor,// / but it is inverse order of SciPy's canonical coo_matrix// / (SciPy employs column-major order for its coo_matrix).func ( *SparseTensorIndexCOO) ( bool) bool {return ._tab.MutateBoolSlot(10, )}func ( *flatbuffers.Builder) { .StartObject(4)}func ( *flatbuffers.Builder, flatbuffers.UOffsetT) { .PrependUOffsetTSlot(0, flatbuffers.UOffsetT(), 0)}func ( *flatbuffers.Builder, flatbuffers.UOffsetT) { .PrependUOffsetTSlot(1, flatbuffers.UOffsetT(), 0)}func ( *flatbuffers.Builder, int) flatbuffers.UOffsetT {return .StartVector(8, , 8)}func ( *flatbuffers.Builder, flatbuffers.UOffsetT) { .PrependStructSlot(2, flatbuffers.UOffsetT(), 0)}func ( *flatbuffers.Builder, bool) { .PrependBoolSlot(3, , false)}func ( *flatbuffers.Builder) flatbuffers.UOffsetT {return .EndObject()}
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.